# -*- coding: utf-8 -*-
import tensorflow as tf

x = tf.Variable([1,2])
t = tf.constant([3,5])
# 初始化为0的变量
counter = tf.Variable(0, name="counter")

# 增加一个减法op
sub = tf.subtract(x,t)
# 增加加法op
add = tf.add(sub, t)
new_value = tf.add(counter, 1)
# 赋值操作
update = tf.assign(counter, new_value)

init = tf.global_variables_initializer()

with tf.Session() as sess:
    sess.run(init)
    print(sess.run(sub))
    print(sess.run(add))
    print(sess.run(counter))
    for _ in range(5):
        sess.run(update)
        print(sess.run(counter))
